<script setup lang="ts">
import { ref } from 'vue'
import { useMemberStore } from '@/stores'
import { getBusinessInfoByUseridAPI } from '@/api/business'
import { onLoad } from '@dcloudio/uni-app'

const useMember = useMemberStore()
const id = useMember.profile.user_id
let isLoginAndUpdatainfo = ref<boolean>()

onLoad(()=> {
  getCompanyInfo()
})

// 获取企业信息

const getCompanyInfo = async () => {
  const res = await getBusinessInfoByUseridAPI(useMember.profile.user_id)
  if (res.data == null) {
    isLoginAndUpdatainfo.value = false
  } else {
    isLoginAndUpdatainfo.value = true
  }
}

</script>

<template>
  <view class="turn company_info" v-if="isLoginAndUpdatainfo">
    <text>您已经提交了入驻信息，</text>
    <text>正在进行审核中...</text>
    <text>请耐心等待</text>
    <navigator :url="'/pages/company/company?id=' + id" class="button phone">查看我的入驻信息</navigator>
  </view>
  <view class="turn" v-else>
    <text>您还没有入驻，选择想要的入驻类型吧</text>
    <navigator url="/pages/join/join" class="button phone">我要入驻</navigator>
  </view>
</template>

<style lang="scss">
.turn {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 150px;
  text {
    display: inline-block;
    padding: 0 50px;
  }
  .button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 300rpx;
    height: 80rpx;
    font-size: 28rpx;
    border-radius: 72rpx;
    color: #fff;
    margin: 40rpx 0 80rpx;
    .icon {
      font-size: 40rpx;
      margin-right: 6rpx;
    }
  }

  .phone {
    background-color: #28bb9c;
  }
}
</style>
